package com.keepmoving.service.impl;

import com.keepmoving.dao.UserDao;
import com.keepmoving.po.User;
import com.keepmoving.service.UserService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zxd
 * 用户业务逻辑实现
 */
@Service(value = "userService")
public class UserServiceImpl implements UserService {

    @Resource
    private UserDao userDao;

    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Override
    public User findById(int lId) {
        return userDao.findById(lId);
    }

    @Override
    public User findByPassAndId(User user) {
        return userDao.findByPassAndId(user);
    }

    @Override
    public boolean addUser(User user) {
        return userDao.addUser(user) > 0 ? true : false;
    }

    @Override
    public boolean update(User user) {
        return userDao.update(user) > 0 ? true : false;
    }

    @Override
    public boolean delete(int lId) {
        return userDao.delete(lId) > 0 ? true : false;
    }

    @Override
    public boolean deleteUser(int id) {
        return userDao.deleteUser(id) > 0 ? true : false;
    }

    @Override
    public int deleteAll(int[] ids) {
        return userDao.deleteAll(ids);
    }
}
